import Vue from 'vue'
import Router from 'vue-router'
import Dashboard from '../components/Dashboard'
import CpuMonitor from '../components/CpuMonitor'
import MemoryMonitor from '../components/MemoryMonitor'
import DeviceStatus from '../components/DeviceStatus'


const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};
Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Dashboard',
      component: Dashboard,
      children: [
          {
              path: '/deviceStatus',
              name: 'DeviceStatus',
              component: DeviceStatus
          },
          {
              path: '/cpuMonitor',
              name: 'CpuMonitor',
              component: CpuMonitor
          },
          {
              path: '/memoryMonitor',
              name: 'MemoryMonitor',
              component: MemoryMonitor
          }
      ]
    }
  ]
})
